{% extends 'views/base.html' %}
{% block body %}
{% include "views/components/header.html" %}
<div class="container margin-top">
    <div class="columns">
        <div class="column is-8 is-offset-2">
            <div class="box markdown-body">
                <h1>{{post.title}}</h1>
                <div>
                    作者：<a href="/user/{{post.author.name}}">{{post.author.name}}</a>
                    {% if post.author._id == ctx.session.user._id %}
                    <div class="is-pulled-right">
                        <a class="button is-small is-primary" href="/posts/{{post._id}}/edit">编辑</a>
                        <a class="button is-small is-danger" href="/posts/{{post._id}}/delete">删除</a>
                    </div>
                    {% endif %}
                </div>
                {{marked(post.content) | safe}}
                <p>
                    <a  href="/posts?c={{post.category.name}}" class="tag is-primary">{{post.category.title}}</a>
                </p>
            </div>
            <section class="margin-top box">
                {% include "views/components/comments.html" %}
            </section>
        </div>
    </div>
</div>
{% endblock %}
